#pragma once

namespace xmlredirect
{
	class IProcessing
	{
	public:
		virtual string	GetPath() = 0;
		virtual void	Add(const xml::pnode& node) = 0;
	};

	class IMoveResult 
	{
	public:
		virtual list< boost::shared_ptr< IRule > >	GetResult() = 0;
	};

	class MoveProcessing : public IMoveResult ,public IProcessing
	{
	public:
		MoveProcessing(const string& path);
		virtual void Add(const xml::pnode& node);
		virtual list< boost::shared_ptr< IRule > > GetResult();
		virtual string	GetPath();

	private:
		void HandleMoveTag(const xml::pnode& node);
		void HandleWhatTag(const xml::pnode& node, MoveData& data);
		string m_path;
		list< boost::shared_ptr< IRule > > m_rules;
	};

	class ISystemSettingResult
	{
	public:
		virtual map<string, string>	GetResult() = 0;
	};

	class SystemSettingProcessing : public IProcessing, public ISystemSettingResult
	{
	public:
		SystemSettingProcessing(const string& path);
		virtual void Add(const xml::pnode& node);
		virtual map<string, string> GetResult();
		virtual string	GetPath();

	private:
		void GetTagAttributeValue( const xml::pnode& node, const string& tagName, const string& tagAttributeName );

		string m_path;
		map<string, string> m_result;
	};

	class ConfigProcessing
	{
	public:
		ConfigProcessing(const string& xmlPath);
		void Add( boost::shared_ptr<IProcessing>& sp_processing);
		void Run();
	
	private:
		void Search( boost::shared_ptr<IProcessing>& proc );

		xml::pdocument m_xml;
		list< boost::shared_ptr<IProcessing> > m_processing;
	};
}
